<%@page import="cn.edu.nju.ws.sview.views.User"%>
<%@page import="cn.edu.nju.ws.sview.views.Group"%>
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" 
 	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Add Group Members</title>
	<link rel="stylesheet" type="text/css" href="/sview/css/group/group.css" />
	<link rel="stylesheet" type="text/css" href="/sview/css/layout.css">	
	<script type="text/javascript" src="/sview/script/jquery.js"></script>
	<script type="text/javascript" src="/sview/script/group/gcreate.js"></script>
<script type="text/javascript" src="/sview/script/global.js"></script>
  </head>
  <%
     String lang = request.getParameter("lang");
     if (lang != null && lang.equals("zh")) {
			request.getRequestDispatcher("addmem_zh.jsp").forward(
					request, response);
		} else if (lang == null) {
			lang = "en";
		}
     String from = request.getParameter("from");
     
     String uname = (String)request.getSession().getAttribute("user");
     if(uname == null){
     	uname = (String)request.getParameter("user");
     }
     String gidStr = (String)request.getParameter("gid");
     if(uname==null || gidStr==null){
    	 response.sendRedirect("/sview/views/index.jsp");
     }else{
     
     int gid = -1;
     //if(request.getParameter("gid") != null){
    // 	gid = Integer.valueOf(request.getParameter("gid"));
     ///}else if(request.getSession().getAttribute("gid") != null){
     gid = Integer.valueOf(gidStr);
     	if(!Group.isMember(gid, User.getUserIdByName(uname))){
     		request.getRequestDispatcher("gmanage.jsp").forward(request, response);
     		return;
     	}
     //}
%>
  <body> 
<jsp:include page="/vheader.jsp" flush="true" />
 <div id="container" class="container">
	    <div class="gHeader"><span class="large">Invite Group Members</span></div>
	    <div class="content">
	    <div class="leftSec">
	    	<div class="search">
			    <label class="searchlabel">member name</label>
				<input class="searchtext" type="text" name="mname" id="mname" />
			    <input type="button" value="Search" class="form-button-little" onclick="return search();">
				<div id="memResult"></div>
		    </div>
	    	<div class="searchResult">
	    		<!-- <ul>
	    		<li><div class="labfirst">select</div><label class="labsecond">user name</label><label class="labthird">email</label></li>
	    		</ul> -->
	    		<table>
	    		<thead>
	    			<tr>
	    				<td class="labfirst">select</td>
	    				<td class="labsecond">user name</td>
	    				<td class="labthird">email</td>
	    			</tr>
	    		</thead>
	    		<tbody>
	    		</tbody>
	    		</table>
	    		<!-- <textarea rows="10" cols="5" class="searchResult"></textarea> -->
	    	</div>
	    </div>
	    <div class="middleSec">
	    	<input type="button" value=">" class="arrow-button" onclick="return addMem();" />
	    	<input type="button" value="<"" class="arrow-button" onclick="return removeMem();" />
	    </div>
	    <div class="rightSec">
	    	<!-- <textarea rows="10" cols="1"></textarea> -->
	    	<div class="selectResult">
	    	<!-- <ul>
	    		<li><div class="labfirst"><label>select</label></div><label class="labsecond">user name</label><label class="labthird">email</label></li>
	    	</ul> -->
	    	<table>
	    	<thead>
	    		<tr>
	    			<td class="labfirst">select</td>
	    			<td class="labsecond">user name</td>
	    			<td class="labthird">email</td>
	    		</tr>
	    	</thead>
	    	<tbody>
	    	</tbody>
	    	</table>
	    	</div>
	    	<input type="button" value="OK" class="form-button-little" style="float:right; margin-right:10px;" onclick="return addAll();">
	    </div>
	    </div>
	    </div>
		<input type="hidden" id="display-lang" value="en" />
	    <input type="hidden" name="gid" id="gid" value='<%=gid %>'>
	    <%if(from!=null){ %>
	          <input type="hidden" id="from" value='<%=from%>' />
	    <%} %>
<jsp:include page="/vfooter.jsp"></jsp:include>
  </body>
  <%} %>
</html>
